<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>

<div id="app">
    <input type="text" v-model="username">
    <br>
    父组件的值{{username}}
    <hr>

    <app :test="username"></app>
</div>
<script>
    let app = {
        template:`
        <div>
        这是子组件传递的数据:{{test}}
</div>
        `,
        props:['test'] //接收数据
    }

    new Vue({
        el: "#app",
        data: {
            username:"",
        },
        components:{
            app:app,
        }
    })
</script>
</body>
</html>